# encoding: utf-8
# project: deep_learning
# file: convolutional_layer.py.py
# time: 2024-12-06 17:24
# author: abcuqe
# license: copyright@ 2002-2024
# contact: abcque@outlook.com
# IDE: PyCharm
# description:  卷积层类的使用
import os
import tensorflow as tf
from keras.layers import Conv2D

if __name__ == '__main__':
    os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'

    x = tf.random.normal([2, 5, 5, 3])

    # layer = Conv2D(4, kernel_size=3, strides=1, padding="SAME")
    # out = layer(x)
    #
    # print(out.shape)

    # layer = Conv2D(4, kernel_size=3, strides=1, padding="VALID")
    layer = Conv2D(4, kernel_size=3, strides=1, padding="VALID", trainable=False)
    out = layer(x)

    # print(out.shape)
    #
    # print(x)
    # print(layer.kernel)
    # print(layer.bias)

    # print(layer.trainable_variables)

    print(layer.non_trainable_variables)
    print(layer.non_trainable_weights)




